//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include <cstdarg>
#include <string>
#include <iostream>
#include <vector>
#include <Tools/Log.hpp>

#define BUFFER_LOG_SIZE 4096
namespace Tools{
//---------------------------------------------------------------------
	// Write message on standart output
	inline void Write(std::string type, const char* buffer) {
		std::cout << type << " : " << buffer << std::endl;
	}
//-----------------------------------------------------------------------------
	void Print(const std::vector<float>& xdf) {
		int size = xdf.size();
		for(int i=0; i<size; ++i) {
			//printf("[%d:%2.3f]",i,xdf[i]);
			std::cout << "["<< i <<":" << xdf[i] << "]";
		}		
		std::cout << "\n";
	}
//-----------------------------------------------------------------------------
	void Print(const char * s, const std::vector<float>& xdf) {		
		std::cout << "Info : xDF ["<< s <<"]";
		Print(xdf);
	}
//-----------------------------------------------------------------------------
	// Log information	
	void Info(const char* Format, ...) {
		char sBuffer[BUFFER_LOG_SIZE];
		va_list Params;
		va_start(Params, Format);
		vsprintf(sBuffer, Format, Params);
		va_end(Params);
		
		// Loggization
		Write("Info", sBuffer);
	}
//-----------------------------------------------------------------------------
	// Log warning
	void Warning(const char* Format, ...) {
		char sBuffer[BUFFER_LOG_SIZE];
		va_list Params;
		va_start(Params, Format);
		vsprintf(sBuffer, Format, Params);
		va_end(Params);
		
		// Loggization
		Write("Warning", sBuffer);
	}
//-----------------------------------------------------------------------------
	// Log error
	void Error(const char* Format, ...) {
		char sBuffer[BUFFER_LOG_SIZE];
		va_list Params;
		va_start(Params, Format);
		vsprintf(sBuffer, Format, Params);
		va_end(Params);
		
		// Loggization
		Write("Error", sBuffer);
	}
}
